#include "run.h"
#include <unistd.h>
#include <string>
#include <iostream>
static const std::string LEXICON_DIR = "resource";
int main(int argc, char *argv[]){
  std::string text("");
  int ch;
  const char *optstring = "t:";
  while((ch = getopt(argc,argv,optstring)) != -1){
    if(ch == 't')
      text += optarg;
  }
  Editor editor(text);
  Runner runner(&editor,LEXICON_DIR);
  while(true){
    std::cout << ">";
    std::string cmd_line;
    getline(std::cin,cmd_line);
    if(cmd_line == "quit")
     exit(0);
    std::string str = runner.run(cmd_line);
    if(!str.empty())
      std::cout << str << std::endl;
  }
  return 0;
}
